<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title>上传新文件</title>
		<link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="../static/web/css/admin.css">
		<script src="../static/web/js/jquery.min.js"></script>
		<script src="../static/web/js/bootstrap.min.js"></script>
		<script src="js/main.js"></script>
		<script>
			function CheckSubmit() {
				if (document.form1.title.value == "") {
					ShowMsg("请设置标题");
					document.form1.title.focus();
					return false;
				}
			}
			var startNum = 6;
			function MakeUpload() {
				var upfield = document.getElementById("uploadfield");
				var endNum = Number(document.form1.picnum.value) + startNum;
				if (endNum > 40) endNum = 40;
				for (startNum; startNum <= endNum; startNum++) {
					upfield.innerHTML += "<p><input type='file' name='upfile" + startNum + "' class='admin-input-md'></p>";
				}
			}
			function ResetUpload() {
				var upfield = document.getElementById("uploadfield");
				upfield.innerHTML = "";
				startNum = 2;
			}
		</script>
	</head>
	<body>
		<table cellpadding="3" cellspacing="1" align="center" class="table maintable my-3">
			<tr>
				<td bgcolor="#f5f5f5" colspan="2">上传新文件</td>
			</tr>
			<tr>
				<td colspan="2">
					<div class="alert alert-info mb-0">图片类型仅支持jpg、png、gif、wbmp格式，视音频和附件为限定扩展名类型，在系统参数中修改</div>
				</td>
			</tr>
			<form enctype="multipart/form-data" name="form1" action="media_add.php" method="POST" onSubmit="return CheckSubmit();">
				<input type="hidden" name="dopost" value="upload">
				<input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token'];?>">
				<tr>
					<td width="260" class="admin-td">媒体类型：</td>
					<td class="admin-td">
						<label><input type="radio" name="mediatype" value="1" checked="1"> 图片</label>
						<label><input type="radio" name="mediatype" value="2"> FLASH</label>
						<label><input type="radio" name="mediatype" value="3"> 视频音频</label>
						<label><input type="radio" name="mediatype" value="4"> 附件其它</label>
					</td>
				</tr>
				<tr>
					<td class="admin-td">说明标题：</td>
					<td class="admin-td"><input type="text" name="title" id="title" class="admin-input-md"></td>
				</tr>
				<tr>
					<td class="admin-td">附加参数：</td>
					<td class="admin-td">
						宽：<input type="text" name="mediawidth" id="mediawidth" class="admin-input-sm">（像素）
						高：<input type="text" name="mediaheight" id="mediaheight" class="admin-input-sm">（像素）
						播放时间：<input type="text" name="playtime" id="mediawidth3" class="admin-input-sm">（分钟）
					</td>
				</tr>
				<tr>
					<td class="admin-td">上传文件：</td>
					<td class="admin-td">
						数量：<input type="text" name="picnum" id="picnum" value="5" class="admin-input-sm">
						<button type="button" name="Submit" class="btn btn-success btn-sm" onclick="MakeUpload()">添加</button>
						<button type="button" name="Submit" class="btn btn-success btn-sm" onclick="ResetUpload()">恢复</button>
					</td>
				</tr>
				<tr>
					<td></td>
					<td>
						<p><input type="file" name="upfile1" id="upfile1" class="admin-input-md"></p>
						<p><input type="file" name="upfile2" id="upfile2" class="admin-input-md"></p>
						<p><input type="file" name="upfile3" id="upfile3" class="admin-input-md"></p>
						<p><input type="file" name="upfile4" id="upfile4" class="admin-input-md"></p>
						<p><input type="file" name="upfile5" id="upfile5" class="admin-input-md"></p>
						<span id="uploadfield"></span>
					</td>
				</tr>
				<tr>
					<td bgcolor="#f5f5f5" colspan="2" align="center"><button type="submit" class="btn btn-success btn-sm">保存</button></td>
				</tr>
			</form>
		</table>
	</body>
</html>